package cn.com.bluemoon.daps.model.core.file.export;

import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.common.exception.DapThrowException;
import cn.com.bluemoon.daps.domp.api.FastDFSService;
import cn.com.bluemoon.daps.model.core.file.export.impl.FastDfsFileExport;
import cn.com.bluemoon.daps.model.core.file.export.impl.WorkbookFileExport;
import cn.com.bluemoon.daps.model.core.file.parser.FileType;

/**
 * @author Jarod.Kong
 * @date 2021/3/23 9:55
 */
public class FileExportFactory {
    /**
     * 统一导出入库
     * @param strategy 策略
     * @param fileExport 文件
     * @param globalConfig 全局配置
     * @return 结果
     */
    public static ResultBean<?> fileExport(ExportStrategy strategy, FileExport fileExport, Object globalConfig) {
        if (strategy != null) {
            IFileExport<?> fileExportClz = strategy.getFileExportClz(globalConfig);
            if (fileExportClz != null) {
                ResultBean<?> export = fileExportClz.export(fileExport);
                return export;
            }
        }
        return ResultBean.FAIL;
    }


}
